package model.onetoone;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * The persistent class for the husband database table.
 * 
 */
@Entity
@Table(name = "husband")
@NamedQuery(name = "Husband.getLastHusband", query = "select max(h.hId) from Husband h")
public class Husband implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "h_id", unique = true, nullable = false)
	private int hId;

	@Column(name = "h_name", nullable = false, length = 45)
	private String hName;

	// bi-directional one-to-one association to Wife
	@OneToOne(cascade = { CascadeType.ALL })
	@JoinColumn(name = "w_id", nullable = false)
	private Wife wife;

	public Husband() {
	}

	public int getHId() {
		return this.hId;
	}

	public void setHId(int hId) {
		this.hId = hId;
	}

	public String getHName() {
		return this.hName;
	}

	public void setHName(String hName) {
		this.hName = hName;
	}

	public Wife getWife() {
		return this.wife;
	}

	public void setWife(Wife wife) {
		this.wife = wife;
	}

}